package com.qimu.saiyou.model.vo;

import com.qimu.saiyou.model.entity.ExamPaper;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;

/**
 * @Author: FeiXiang
 * @Date: 2024年03月01日 21:36
 * @Version: 1.0
 * @Description:
 */
@Data
public class ExamPaperVO {
    private Long id;
    /**
     * 试卷标题
     */
    private String title;

    /**
     * 及格分
     */
    private Integer qualifyScore;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 总分
     */
    private Integer totalScore;
    private List<QuestionVO> questionList;

    /**
     * 包装类转对象
     *
     * @param competeExamVO 问答
     * @return {@link QuestionAnswerVO}
     */
    public static ExamPaper voToObj(ExamPaperVO competeExamVO) {
        if (competeExamVO == null) {
            return null;
        }
        ExamPaper examPaper = new ExamPaper();
        BeanUtils.copyProperties(competeExamVO, examPaper);
        return examPaper;
    }

    /**
     * 对象转包装类
     *
     * @return
     */
    public static ExamPaperVO objToVo(ExamPaper examPaper) {
        if (examPaper == null) {
            return null;
        }
        ExamPaperVO examPaperVO = new ExamPaperVO();
        BeanUtils.copyProperties(examPaper, examPaperVO);
        return examPaperVO;
    }
}
